#include <iostream>
#include <vector>
#include <string>

#include "stringop.h"

using namespace std;

//Gets the width here please !
string :: size_type max_width(vector<string>& tomax){

    string :: size_type maxlen = 0;

    for (vector<string>::size_type i=0; i!=tomax.size(); i++){
        maxlen = max(maxlen,tomax[i].size());
    }

    return maxlen;

}

vector<string> frame(const vector<string>& main_str){

    vector<string> ret;
    
    //compute the width
    string::size_type max_len = max_width(main_str);
    string border(max_len+4,'*');

    ret.push_back(border);

    for (vector<string>::size_type i=0; i!= main_str.size(); i++)
        ret.push_back(" *" + main_str[i] + string(maxlen-main_str[i].size(),' ')+" *");

    ret.push_back(border);
    return ret;

}


